package com.clk.portfoy.complib;

import java.awt.Color;

import com.clk.desktop.gui.components.basic.ClkLabel;
import com.clk.portfoy.PortfoyStatics;

public class ClkDegerLabel extends ClkLabel {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	double anlikDegerSet[];

	// ---------------------------------------------------------------------------------
	public ClkDegerLabel() {
		super();
		this.setHorizontalAlignment(RIGHT);
	}

	// ---------------------------------------------------------------------------------
	public void setValue(double value[]) {
		if (value[0] < value[1]) {
			// red
			this.setBackground(Color.RED);
		} else if (value[0] > value[1]) {
			// green
			this.setBackground(Color.GREEN);
		} else {
			// yellow
			this.setBackground(Color.YELLOW);
		}
		if (value.length > 2) {
			if (value[2] > 0) {
				this.setIcon(PortfoyStatics.imgUpArrow);
			} else if (value[2] < 0) {
				this.setIcon(PortfoyStatics.imgDownArrow);
			} else if (value[2] == 0) {
				this.setIcon(PortfoyStatics.imgStableBall);
			}
		}
		this.setText(PortfoyStatics.getDoubleStr(value[0]));
	}
	// ---------------------------------------------------------------------------------
}
